Когда Python начинает тормозить, а оптимизировать хочется — на помощь приходит Cython. Это надстройка над Python, которая позволяет писать на «почти C» и при этом вызывать C-библиотеки и оставаться в экосистеме Python.
➡️ Что делает Cython: — Позволяет указывать типы переменных как в C — Ускоряет численные расчёты и алгоритмы — Превращает .pyx-файл в скомпилированный .so, который можно импортировать как обычный модуль
➡️ Пример на алгоритме поиска простых чисел: — В Python — 0.0566 секунды — В Cython — 0.0054 секунды (на обычном ноутбуке)
Если вы работаете с алгоритмами, машинным обучением или просто любите скорость — попробуйте переписать пару функций с cdef и замерьте время. Разница чувствуется сразу.
Когда Python начинает тормозить, а оптимизировать хочется — на помощь приходит Cython. Это надстройка над Python, которая позволяет писать на «почти C» и при этом вызывать C-библиотеки и оставаться в экосистеме Python.
➡️ Что делает Cython: — Позволяет указывать типы переменных как в C — Ускоряет численные расчёты и алгоритмы — Превращает .pyx-файл в скомпилированный .so, который можно импортировать как обычный модуль
➡️ Пример на алгоритме поиска простых чисел: — В Python — 0.0566 секунды — В Cython — 0.0054 секунды (на обычном ноутбуке)
Если вы работаете с алгоритмами, машинным обучением или просто любите скорость — попробуйте переписать пару функций с cdef и замерьте время. Разница чувствуется сразу.
China’s stock markets are some of the largest in the world, with total market capitalization reaching RMB 79 trillion (US$12.2 trillion) in 2020. China’s stock markets are seen as a crucial tool for driving economic growth, in particular for financing the country’s rapidly growing high-tech sectors.Although traditionally closed off to overseas investors, China’s financial markets have gradually been loosening restrictions over the past couple of decades. At the same time, reforms have sought to make it easier for Chinese companies to list on onshore stock exchanges, and new programs have been launched in attempts to lure some of China’s most coveted overseas-listed companies back to the country.
Telegram Auto-Delete Messages in Any Chat
Some messages aren’t supposed to last forever. There are some Telegram groups and conversations where it’s best if messages are automatically deleted in a day or a week. Here’s how to auto-delete messages in any Telegram chat. You can enable the auto-delete feature on a per-chat basis. It works for both one-on-one conversations and group chats. Previously, you needed to use the Secret Chat feature to automatically delete messages after a set time. At the time of writing, you can choose to automatically delete messages after a day or a week. Telegram starts the timer once they are sent, not after they are read. This won’t affect the messages that were sent before enabling the feature.